package streamLogStatic.pojos

import java.sql.{Date, Timestamp}

import com.google.gson.Gson
import org.apache.flink.api.common.serialization.AbstractDeserializationSchema

/**
  *
  * @ClassName weblog
  * @Description 网站访问日志 pojo
  *              url 访问地址，user 用户，click_ts 点击时间
  * @Author dalong
  * @Date 2020/6/15 22:55
  * @Version 1.0
  **/

class weblog(var visitURL:String,var userName:String,var click_ts:Double) {

  def this(){
    this(null,null,0.0)
  }
}

/*
* 自定义kafka数据解析为pojo类结构
* */
class weblogDesc extends AbstractDeserializationSchema[weblog]{
  override def deserialize(bytes: Array[Byte]): weblog = {

    val gson = new Gson()

    val sourcestr = new String(bytes)
    val webBean:weblog = gson.fromJson(sourcestr,classOf[weblog])

    webBean
  }
}


